pattern matching in instance of operator